package com.itheima.网络编程.udp编程;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class UdpServer1x {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket(10331);
        while (true) {
            byte[] bys = new byte[1024 * 1024];
            DatagramPacket dp = new DatagramPacket(bys, bys.length);
            ds.receive(dp);
            String string = new String(dp.getData(),0,dp.getLength());
            System.out.println(string);
        }

        //ds.close();
    }
}
